package ex.mlist;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.telephony.TelephonyManager;
import android.util.Log;

public class Phone_receiver extends BroadcastReceiver {

	@Override
	public void onReceive(Context context, Intent intent) {
		Bundle extras = intent.getExtras();
		if (extras != null) {
			String state = extras.getString(TelephonyManager.EXTRA_STATE);
			Log.w("DEBUG", state);
			
			if (state.equals(TelephonyManager.EXTRA_STATE_RINGING)) 
			{
				
				
				Intent i = new Intent(context,TonesetActivity.class);
				i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
				 context.startActivity(i);
				
			}
		}
	}
}